﻿///////////////////////////////////////////////////////////////
//                                                           //
// Code from Arcanea Project.                                //
//                                                           //
// Please include this license part to every reproduction    //
//   of code.                                                //
//                                                           //
// This code is under Ms-RL license                          //
//                                                           //
// Please read futher information about the license,         //
//   the project (news and updates) and the                  //
//   contributors on the address :                           //
//     http://www.codeplex.com/Arcanea/                      //
//                                                           //
///////////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
//using System.Linq;
using System.Text;
using System.Reflection;
using Arcanea.Mediator.Exceptions;
using Arcanea.BaseEngine.Interfaces;
using log4net;

namespace Arcanea.BaseEngine.Generics
{
     /// <summary>
    /// Interface qui définit le contrat que doit respecter un module
    /// d'accés à une base.
    /// </summary>
    public abstract class IBaseAccess : IDisposable
    {
        /// <summary>
        /// Fonction de connection a la base.
        /// </summary>
        /// <param name="connectionString">Connection string</param>
        /// <returns></returns>
        public abstract bool Connection(string connectionString);

        /// <summary>
        /// Fonction d execution simple d une requete Sql
        /// </summary>
        /// <param name="command">Commande a executer</param>
        /// <returns>Nombre d enregistrement impacte</returns>
        public abstract int ExecuteSimple(string command);

        /// <summary>
        /// Fonction d execution d une requete Sql qui retournera une string
        /// </summary>
        /// <param name="command">Commande a executer</param>
        /// <returns>La string trouvee</returns>
        public abstract string ExecuteAndGetOneString(string command);

        /// <summary>
        /// Fonction d execution d une requete Sql qui retournera un int
        /// </summary>
        /// <param name="command">Commande a executer</param>
        /// <returns>Le int trouve</returns>
        public abstract int ExecuteAndGetOneInt(string command);

        /// <summary>
        /// Fonction d execution d une requete Sql qui retournera un resultSet
        /// </summary>
        /// <param name="command">Commande a executer</param>
        /// <returns>Le resultSet trouve</returns>
        public abstract IBaseResultSet ExecuteQuery(string command);

        /// <summary>
        /// Annonce si la connection a ete ouverte precedement
        /// </summary>
        /// <returns>True si oui</returns>
        public abstract bool IsOpenned();

        /// <summary>
        /// Close la connection courante
        /// </summary>
        public abstract void Close();

        #region IDisposable Membres

        public virtual void Dispose()
        {
        }

        #endregion
    }
}
